#ifndef TRANSFORMATION_H_INCLUDED
#define TRANSFORMATION_H_INCLUDED

#include "Matrix.h"

/// Parameter states for dynamic data
enum ePIE_PARAMSTATE{
	NOW = -1,		// Current value
	FIRST = 0,		// First value
	LAST,				// Previous value
	NEXT,				// Next value
	FINAL				// Target value
};

/// This is the count of the parameter states above, (>= 0 only)
#define PIE_PARAMSTATE_COUNT 4

/// Instance transformation data for 3D instancing
struct sTransformationData3D {
	// Data
	vec3r m_Scale;					///< Object scale vector
	vec3r m_Shear;					///< Object shear vector
	quatr	m_Orientation;			///< Object orientation in 3D space using quaternion
	vec3r	m_Velocity;				///< Object's unit movement direction * velocity
	quatr	m_SpinVelocity;		///< Object's rotational axis and velocity
	real	m_Acceleration;		///< Object movement acceleration
	real	m_SpinAcceleration;	///< Object rotation acceleration
	mat4r	m_Transformation;		///< Contains position and axii
	real	m_Clock;					///< Object's inner clock

	// Constructor
	sTransformationData3D( vec3r pos = ORIGIN ) :
		m_Scale(ONEVEC),
		m_Shear(ORIGIN),
		m_Orientation(DEFAULT_ORIENTATION),
		m_Velocity(ORIGIN),
		m_SpinVelocity(DEFAULT_ORIENTATION),
		m_Acceleration(0),
		m_SpinAcceleration(0),
		m_Transformation(mat4r( RIGHT, UP, FORWARD, pos, ONEVEC )),
		m_Clock(0) { }
};

/// Instance transformation data for 2D instancing
struct sTransformationData2D {
	// Data
	vec2r m_Scale;					///< Object scale vector
	vec2r m_Shear;					///< Object shear vector
	real	m_Orientation;			///< Object orientation in 2D space using angle
	vec2r	m_Velocity;				///< Object's unit movement direction * velocity
	real	m_SpinVelocity;		///< Object orientation in 2D space using angle
	real	m_Acceleration;		///< Object movement acceleration
	real	m_SpinAcceleration;	///< Object rotation acceleration
	mat4r	m_Transformation;		///< Contains position and axii
	real	m_Clock;					///< Object's inner clock

	// Constructor
	sTransformationData2D( vec3r pos = ORIGIN ) :
		m_Scale(1,1),
		m_Shear(0,0),
		m_Orientation(0),
		m_Velocity(0,0),
		m_SpinVelocity(0),
		m_Acceleration(0),
		m_SpinAcceleration(0),
		m_Transformation(mat4r( RIGHT, UP, FORWARD, pos )),
		m_Clock(0) { }
};

struct sCameraData {
	real 	fieldofview;
	real 	nearplane;
	real 	farplane;
	int 	viewport[4];
	bool	orthogonal;
};

struct sLightData {
	real  range;
	rgb   color;
};

#endif // TRANSFORMATION_H_INCLUDED
